#pragma once
#include "SampleBasisClass.h"
#include "BasisCamera.h"
#include "BasisPanel.h"
#include <d3dx11effect.h>


class Sample : public SampleBasisClass
{
//--------------------------------------------------------------------------------------
// Structures
//--------------------------------------------------------------------------------------
public:
	struct SimpleVertex
	{
		D3DXVECTOR3 p;
		D3DXVECTOR4 c;
		D3DXVECTOR2 t;
	};
public:
	//--------------------------------------------------------------------------------------
	// Effect Variables
	//--------------------------------------------------------------------------------------
	ID3DX11Effect*           m_pEffect;
	ID3DX11EffectTechnique*  m_pTechnique;
	ID3D11InputLayout*      m_pVertexLayout;
	ID3D11Buffer*           m_pVertexBuffer;
	ID3D11Buffer*           m_pIndexBuffer;

	//--------------------------------------------------------------------------------------
	// Matrix
	//--------------------------------------------------------------------------------------
	D3DXMATRIX					m_World;
	BasisCamera					m_Camera;
	ID3DX11EffectMatrixVariable* m_pWorldVariable;
	ID3DX11EffectMatrixVariable* m_pViewVariable;
	ID3DX11EffectMatrixVariable* m_pProjectionVariable;
public:	
	//--------------------------------------------------------------------------------------
	// Effect Variables
	//--------------------------------------------------------------------------------------
	HRESULT		LoadEffectFile();
	HRESULT		SetInputLayout();

	HRESULT		CreateVertexBuffer(float _left= -1, float _right = 1, float _top = 1, float _bottom = -1, float _minZ = -1, float _maxZ = 1);
	HRESULT		CreateIndexBuffer();

 	bool		Init();
 	bool		Frame();
 	bool		ToRender();
 	bool		Release();
 	LRESULT		WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam );

public:
	float m_boxLeft, m_boxRight, m_boxTop, m_boxBottom, m_boxMinZ, m_boxMaxZ;
	void BoxRender(float _w=1, float _h=1, float _sizeZ=1, float _x=0, float _y=0, float _z = 0);
	bool HitTest(D3DXVECTOR3* Cvectro);
	BasisPanel m_Panel;
public:
	HRESULT CreateSmapleState();
	ID3D11SamplerState* m_pSampleState;
	 HRESULT Sample::TextureLoad2(WCHAR* StrFileName);

public:
	Sample(void);
	~Sample(void);
public:
	HRESULT SetBlendState(int index = 0);
	ID3D11BlendState*           m_pAlphaBlend;
	HRESULT TextureLoad1(WCHAR* StrFileName);
	ID3D11ShaderResourceView* m_pTextureArr[6];
	ID3D11ShaderResourceView* m_pTexture1;
	ID3DX11EffectShaderResourceVariable* m_pTextureVariable1;
	//HRESULT TextureLoad2(WCHAR* StrFileName);
	//ID3D11ShaderResourceView* m_pTexture2;
	//ID3DX11EffectShaderResourceVariable* m_pTextureVariable2;
};
